package com.woniu.config;

import org.springframework.ai.chat.client.ChatClient;

import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Flux;

@Service
public class ChatService {
    private final ChatClient chatClient;

    public ChatService(ChatClient.Builder chatClientBuilder, ToolCallbackProvider tools) {
        this.chatClient = chatClientBuilder
                .defaultToolCallbacks(tools)
//                .defaultTools()
                .build();
    }

    public Flux<String> processQuery(String userInput) {
        return chatClient.prompt(userInput).stream().content();
    }


}
